home *** CD-ROM | disk | FTP | other *** search
/ C/C++ Users Group Library 1996 July / C-C++ Users Group Library July 1996.iso / vol_400 / 400_01 / socketpp-1.5 / test / thostnames.cc < prev    next >
Encoding:
C/C++ Source or Header  |  1993-11-06  |  356 b   |  19 lines

  1. #include <sockinet.h>
  2.  
  3. main(int ac, char** av)
  4. {
  5.     if (ac != 2) {
  6.         cerr << "USAGE: " << av[0] << " hostname\n";
  7.         return 1;
  8.     }
  9.     
  10.     iosockinet    sio(sockbuf::sock_stream);
  11.     sockinetaddr     sina("nic.ddn.mil", "hostnames", "tcp");
  12.  
  13.     sio->connect(sina);
  14.  
  15.     sio << "HNAME " << av[1] << "\r\n";
  16.     char buf[1024];
  17.     while (sio.getline(buf, 1023)) cout << buf << endl;
  18. }
  19.